<template>
  <div class="rating-component">
    <div class="rating-info snap-item">
      <div class="rating-content">
        <div class="rating-star">
          <div class="rating-star-image">
            <img
              :src="ratingInfo.logo"
              :alt="ratingInfo.platform + ' logo'"
              style="width: 100%; height: 100%; object-fit: contain"
            />
          </div>
          <div class="rating-star-text">
            <div class="rating-star-title">{{ ratingInfo.platform }}</div>
            <div class="rating-star-details">
              <span class="rating-value">{{ ratingInfo.rating }}</span>
              <i class="el-icon-star-on" style="color: #efb82c"></i>
              <span class="rating-review-count">({{ ratingInfo.reviews }} Reviews)</span>
            </div>
          </div>
        </div>
        <div class="rating-empty-space"></div>
        <div class="rating-response-rate">
          <div class="response-container">
            <div class="response-rate-info">
              <div class="response-rate-label">Response rate</div>
              <div class="response-rate-value">{{ ratingInfo.responseRate }}%</div>
              <div class="response-rate-arrow">
                <img src="@/assets/resAndBar/updown.png" alt="Trend arrow" />
              </div>
            </div>
            <div class="response-time-info">avg response time {{ ratingInfo.responseTime }}</div>
            <div class="el-progress-container">
              <el-progress
                :text-inside="false"
                :stroke-width="10"
                :percentage="ratingInfo.responseRate"
              ></el-progress>
            </div>
            <div class="number">
              <div class="guests-num">Guests: <span>{{ ratingInfo.guests }}</span></div>
              <div class="reviews-num">Reviews: <span>{{ ratingInfo.recentReviews }}</span></div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "StaticRatingBox",
  props: {
    ratingInfo: {
      type: Object,
      required: true
    }
  }
};
</script>

<style lang="scss" scoped>
.rating-component {
  height: 100%;
  display: flex;
  flex-direction: column;
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  position: relative;
  border-radius: 0.0556rem;
}

.rating-info {
  display: inline-block;
  margin-right: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fff;
  position: relative;
  border: 1px solid #cdcccc;
  border-radius: 0.0556rem;

  .rating-star {
    padding: 16px 24px 0 16px;
    text-align: center;
    display: flex;
    width: 100%;
    height: 0.5764rem;
    border-radius: 0.0556rem;
    border: none !important;
    background: #d2ebff;
    box-sizing: border-box;

    .rating-star-image {
      width: 0.3542rem;
      height: 0.3472rem;
      margin-right: 16px;

      img {
        width: 100%;
        height: 100%;
      }
    }

    .rating-star-text {
      display: flex;
      flex-direction: column;
      text-align: start;

      .rating-star-title {
        font-size: 18px;
        font-weight: 600;
        margin-bottom: 8px;
        color: #232323;
      }

      .rating-star-details {
        display: flex;
        align-items: center;
        text-align: center;

        .rating-value {
          font-size: 16px;
          font-weight: 600;
          color: #000;
        }
        .el-icon-star-on {
          padding: 0px 3px;
        }
        .rating-review-count {
          font-size: 14px;
          font-weight: 600;
          color: #454545;
        }
      }
    }
  }

  .rating-empty-space {
    height: 0.0556rem;
    background: #fff;
  }

  .rating-response-rate {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 0.7431rem;
    background: #fff;
    box-sizing: border-box;
    padding: 0px 24px 16px 24px;

    .response-rate-info {
      display: flex;
      font-size: 16px;
      margin-bottom: 8px;

      .response-rate-label {
        color: #454545;
        font-size: 16px;
        font-weight: 400;
      }

      .response-rate-value {
        font-weight: 600;
        margin-right: 8px;
        margin-left: 8px;
      }
    }

    .response-time-info {
      font-size: 12px;
      font-weight: 400;
      text-align: left;
      margin-bottom: 16px;
    }

    .el-progress-container {
      margin-bottom: 8px;
      width: 100%;
      ::v-deep .el-progress {
        border-radius: 8px;
      }
      ::v-deep .el-progress-bar {
        padding-right: 0;
      }
      ::v-deep .el-progress-bar__outer {
        background-color: #fff;
      }
      ::v-deep .el-progress-bar__inner {
        background-color: #2faa68;
      }
      ::v-deep .el-progress__text {
        display: none;
      }
    }

    .number {
      margin-top: 8px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 12px;
      font-weight: 400;
      width: 100%;

      .guests-num {
        margin-right: 32px;
        color: #6a6969;
        span {
          color: #232323;
        }
      }

      .reviews-num {
        color: #6a6969;
        span {
          color: #232323;
        }
      }
    }
  }
}
</style>